#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int64_t GetAns(int64_t n)
{
    if(n<=1) return 1;
    else if(n==2) return 2;
    int64_t ans = n * (n-1);
    int64_t t = 0;
    for(int64_t i=1;i<=n-2;++i)
    {
        int64_t tmp = i / __gcd(ans, i);
        if(tmp>t) t = tmp;
    }
    return ans * t;
}

int main()
{
    int64_t n;
    while(cin>>n)
    {
        cout<<max(GetAns(n), GetAns(n-1))<<endl;
    }
    return 0;
}
